﻿CREATE TABLE [dbo].[AngajatiGarzi] (
    [IDGarda]             INT      IDENTITY (1, 1) NOT NULL,
    [CodUnitate]          SMALLINT NOT NULL,
    [Luna]                SMALLINT NOT NULL,
    [Anul]                SMALLINT NOT NULL,
    [IDPersoana]          INT      NOT NULL,
    [IDAngajatSalarizare] INT      NOT NULL,
    [StartGarda]          DATETIME NOT NULL,
    [EndGarda]            DATETIME NOT NULL,
    [IDAngajatInlocuit]   INT      NULL,
    CONSTRAINT [PK_AngajatiGarzi] PRIMARY KEY CLUSTERED ([IDGarda] ASC),
    CONSTRAINT [FK_AngajatiGarzi_AngajatiSalarizare] FOREIGN KEY ([IDAngajatSalarizare]) REFERENCES [dbo].[AngajatiSalarizare] ([IDAngajatSalarizare]),
    CONSTRAINT [FK_AngajatiGarzi_AngajatiSalarizare1] FOREIGN KEY ([IDAngajatInlocuit]) REFERENCES [dbo].[AngajatiSalarizare] ([IDAngajatSalarizare]),
    CONSTRAINT [FK_AngajatiGarzi_Persoane] FOREIGN KEY ([IDPersoana]) REFERENCES [dbo].[Persoane] ([IdPersoana]),
    CONSTRAINT [FK_AngajatiGarzi_Unitati] FOREIGN KEY ([CodUnitate]) REFERENCES [dbo].[Unitati] ([CodUnitate])
);

